/**
 * 04/12/2013
 * 
 * Login
 * 
 * Copyright GPL
 */
package com.jtmproject.actions;

import com.jtmproject.database.UserDAO;
import com.opensymphony.xwork2.ActionSupport;

/**
 * This is an action to show
 * @author Javier Tejedor
 */
public class Login extends ActionSupport {

	private String login;
	private String password;
	private String signIn;
	private String result;
	
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -5027611362562431121L;

	/* (non-Javadoc)
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	 */
	@Override
	public String execute() throws Exception {

		if(UserDAO.getUserDAO().checkLogin(login, password)){
			result = "Logueado correctamente";
			return SUCCESS;
		} else {
			result = "No logueado";
			return ERROR;
		}

	}
	
    /* (non-Javadoc)
     * @see com.opensymphony.xwork2.ActionSupport#input()
     */
    @Override
    public String input() throws Exception{
    	return super.input();
    }

	/**
	 * this returns the login
	 * @return
	 */
	public String getLogin() {
		return login;
	}

	/**
	 * this sets the login
	 * @param login
	 */
	public void setLogin(String login) {
		this.login = login;
	}

	/**
	 * this returns the password
	 * @return
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * this sets the password
	 * @param password
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * this returns the signIn
	 * @return
	 */
	public String getSignIn() {
		return signIn;
	}

	/**
	 * this sets the signIn
	 * @param signIn
	 */
	public void setSignIn(String signIn) {
		this.signIn = signIn;
	}

	/**
	 * this returns the result
	 * @return
	 */
	public String getResult() {
		return result;
	}

	/**
	 * this sets the result
	 * @param result
	 */
	public void setResult(String result) {
		this.result = result;
	}
   
}